package com.zsrt.javase.c008.t01.p02;


public class answerP02 {
	
	
	public static void main(String[] args) {
		
		
		int gz =0;
		int sum =1000;
		int aa=0;
		aa= js(sum);
		gz= sum%3;
		while(aa >=3){
			System.out.println("aa="+aa + ",gz="+gz);
			gz= gz+ aa%3;
			sum= sum + aa;
			aa= js(aa);
			
			//System.out.println("aaaa="+aa);
		}
		System.out.println("last aa =" + aa + ",gz="+gz);
		System.out.println("sum="+(sum+aa + gz/3));
		//System.err.println("sum=" +(sum + gz/3 +1));
	}
	
	
	public static int js(int qty){
		
		if(qty<3){
			return 0;
		}else{
			return 1+js(qty-3);
		}
	}
}
